package com.company.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.company.common.annotation.Log;
import com.company.common.core.controller.BaseController;
import com.company.common.core.domain.AjaxResult;
import com.company.common.enums.BusinessType;
import com.company.system.domain.TablePositionaltitleslist;
import com.company.system.service.ITablePositionaltitleslistService;
import com.company.common.utils.poi.ExcelUtil;
import com.company.common.core.page.TableDataInfo;

/**
 * 职称列Controller
 * 
 * @author ruoyi
 * @date 2022-07-06
 */
@RestController
@RequestMapping("/system/positionaltitleslist")
public class TablePositionaltitleslistController extends BaseController
{
    @Autowired
    private ITablePositionaltitleslistService tablePositionaltitleslistService;

    /**
     * 查询职称列列表
     */
    @PreAuthorize("@ss.hasPermi('system:positionaltitleslist:list')")
    @GetMapping("/list")
    public TableDataInfo list(TablePositionaltitleslist tablePositionaltitleslist)
    {
        startPage();
        List<TablePositionaltitleslist> list = tablePositionaltitleslistService.selectTablePositionaltitleslistList(tablePositionaltitleslist);
        return getDataTable(list);
    }

    /**
     * 导出职称列列表
     */
    @PreAuthorize("@ss.hasPermi('system:positionaltitleslist:export')")
    @Log(title = "职称列", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TablePositionaltitleslist tablePositionaltitleslist)
    {
        List<TablePositionaltitleslist> list = tablePositionaltitleslistService.selectTablePositionaltitleslistList(tablePositionaltitleslist);
        ExcelUtil<TablePositionaltitleslist> util = new ExcelUtil<TablePositionaltitleslist>(TablePositionaltitleslist.class);
        util.exportExcel(response, list, "职称列数据");
    }

    /**
     * 获取职称列详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:positionaltitleslist:query')")
    @GetMapping(value = "/{positionaltitlesid}")
    public AjaxResult getInfo(@PathVariable("positionaltitlesid") Long positionaltitlesid)
    {
        return AjaxResult.success(tablePositionaltitleslistService.selectTablePositionaltitleslistByPositionaltitlesid(positionaltitlesid));
    }

    /**
     * 新增职称列
     */
    @PreAuthorize("@ss.hasPermi('system:positionaltitleslist:add')")
    @Log(title = "职称列", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TablePositionaltitleslist tablePositionaltitleslist)
    {
        return toAjax(tablePositionaltitleslistService.insertTablePositionaltitleslist(tablePositionaltitleslist));
    }

    /**
     * 修改职称列
     */
    @PreAuthorize("@ss.hasPermi('system:positionaltitleslist:edit')")
    @Log(title = "职称列", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TablePositionaltitleslist tablePositionaltitleslist)
    {
        return toAjax(tablePositionaltitleslistService.updateTablePositionaltitleslist(tablePositionaltitleslist));
    }

    /**
     * 删除职称列
     */
    @PreAuthorize("@ss.hasPermi('system:positionaltitleslist:remove')")
    @Log(title = "职称列", businessType = BusinessType.DELETE)
	@DeleteMapping("/{positionaltitlesids}")
    public AjaxResult remove(@PathVariable Long[] positionaltitlesids)
    {
        return toAjax(tablePositionaltitleslistService.deleteTablePositionaltitleslistByPositionaltitlesids(positionaltitlesids));
    }
}
